#------------------------------------------------------------------------------
# definiendo fuentes para la libreria
#------------------------------------------------------------------------------
FILE(GLOB_RECURSE utils_headers "src/*.h")
FILE(GLOB_RECURSE utils_sources "*src/*.cpp")


IF(${CMAKE_BUILD_TYPE} MATCHES "Debug" )
	SET(THIRD_PARTY_LIBS "${PROJECT_BINARY_DIR}/${THIRD_PARTY_LIB_DIR}/debug")
ELSEIF(${CMAKE_BUILD_TYPE} MATCHES "Release" )
	SET(THIRD_PARTY_LIBS "${PROJECT_BINARY_DIR}/${THIRD_PARTY_LIB_DIR}/release")
ENDIF()

#------------------------------------------------------------------------------
# Generando libreria "utils"
#------------------------------------------------------------------------------
message("Generating library utils")
ADD_LIBRARY(utils STATIC ${utils_sources} ${utils_headers})

#------------------------------------------------------------------------------
# definiendo fuentes para el ejecutable de tests
#------------------------------------------------------------------------------
FILE(GLOB_RECURSE test_utils_headers "test/*.h")
FILE(GLOB_RECURSE test_utils_sources "test/*.cpp")

#SET(TEST_LIBS ${THIRD_PARTY_LIBS}/libgtest.a ${THIRD_PARTY_LIBS}/libgtest_main.a pthread utils "${BOOST_DIR}/stage/lib/libboost_system.a")
SET(TEST_LIBS 
	gtest_main 
	gtest 
	pthread
        core
        log
	utils  
	"${BOOST_DIR}/stage/lib/libboost_system.a" 
        "${BOOST_DIR}/stage/lib/libboost_filesystem.a"
	)

INCLUDE_DIRECTORIES(
	"${PROJECT_BINARY_DIR}/${THIRD_PARTY_INC_DIR}"
	"${PROJECT_SOURCE_DIR}/modules/core/src"
	"${PROJECT_SOURCE_DIR}/modules/Log/src"
        "${PROJECT_SOURCE_DIR}/modules/utils/src"
)

#------------------------------------------------------------------------------
# Generando ejecutable de test unitarios
#------------------------------------------------------------------------------
ADD_EXECUTABLE(utils_test ${test_utils_sources} ${test_utils_headers})
TARGET_LINK_LIBRARIES(utils_test ${TEST_LIBS})

#------------------------------------------------------------------------------
# Ejecutando test cases
#------------------------------------------------------------------------------
enable_testing()
IF(ZEL_EXECUTE_TESTS)
	add_test(NAME testing_utils 
				COMMAND utils_test)
ENDIF()